<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
</head>
<meta charset="UTF-8">
<title>登录成功</title>
<body>
<script>
function check()
    {
      var username=sessionStorage.key(sessionStorage.length);
         if(sessionStorage.length==0)
        {
         alert("非法访问！");
         window.location.href='http://zhuguangqi.gitee.io/buptsice_training_2017_2/denglu.html'
        }
         else { var list = document.getElementById("okname"); 
                    list.innerHTML =sessionStorage.getItem("username");
                loadAll();
       }
    }
function loadAll()
  {  
      var list = document.getElementById("list");  
            if(localStorage.length>0)
          {  
            var result = "<table border='1'>";  
            result += "<tr><td>用户名</td><td>密码</td><td>邮箱</td><td>注册时间</td></tr>";  
              for(var i=0;i<localStorage.length;i++)
            {  
                var sitename = localStorage.key(i);  
                var str = localStorage.getItem(sitename); 
                var site = JSON.parse(str);
                result += "<tr><td>"+sitename+"</td><td>"+site.siteurl+"</td><td>"+site.sitename+"</td><td>"+site.nowtime+"</td></tr>";  
            }  
                result += "</table>";  
                list.innerHTML = result;  
          }
            else
            {  
                list.innerHTML = "数据为空……";  
            }  
  }      
        $(document).ready(function(){
        $("button").click(function(){
            $.ajax({url:"http://web.juhe.cn:8080/constellation/getAll?consName="+$("#consName").val()+"&type="+$("#type").val()+"&key=d64fd8e1ba4fb9192314cf4d2924af78",success:function(result)
                    {
                      var show = "<table border='0'>"
                          show += 
                             "<tr><td>星座名称</td><td>日期</td><td>综合指数</td><td>幸运色</td><td>健康指数</td><td>爱情指数</td><td>财运指数</td><td>幸运数字</td><td>速配星座</td><td>工作指数</td></tr>";  
                          show += "<tr><td>"+result.name+"</td><td>"+result.datetime+"</td><td>"+result.all+"</td><td>"+result.color+"</td><td>"+result.health+"</td><td>"+result.love+"</td><td>"+result.money+"</td><td>"+result.number+"</td><td>"+result.QFriend+"</td><td>"+result.work+"</td></tr>";  
                          show += "</table>"; 
                    },
              }); 
        });
    });
  </script>
  <div class="container container-small">
	<h1>登录成功</h1>	
	<hr/>
  </div>
  <font size="6" color="red"><b id="okname"></b> </font>
  <font size="3"> 你好~ </font>
  <div id="list"> </div>
  <a href="http://zhuguangqi.gitee.io/buptsice_training_2017_2/denglu.html">注销</a>
  <label for="xingzuo">星座:</label> <input type="text" id="consName" placeholder="输入你要查询的星座"><br>
  <label for="riqi">要查询的日期:</label> <input type="text" id="type" placeholder="输入要查询的日期"><br>
  <p>只能输入today,tomorrow,week,nextweek,month,year中的一个哦。功能有限请谅解。</p>
  <button id="chaxun">查询</button>

	</body>
  </html>